import SwiftUI

extension Color {
    //    文字颜色
    static let g_color_font_primary = Color(hex: 0x171A1D, alpha: 1)
    static let g_color_font_secondary = Color(hex: 0x171A1D, alpha: 0.6)
    static let g_color_font_description = Color(hex: 0x171A1D, alpha: 0.4)
    static let g_color_font_disabled = Color(hex: 0x171A1D, alpha: 0.24)
    static let g_color_font_fadeout = Color(hex: 0xFFFFFF, alpha: 0.4)
    static let g_color_font_white = Color(hex: 0xFFFFFF, alpha: 1)
    
    //    背景色
    static let g_color_bg_grey = Color(hex: 0xF2F2F6, alpha: 1)
    static let g_color_bg_white = Color(hex: 0xFFFFFF, alpha: 1)
    static let g_color_bg_dark = Color(hex: 0x171A1D, alpha: 0.24)
    static let g_color_bg_transparent = Color(hex: 0xFFFFFF, alpha: 0)
    static let g_color_bg_gradient_white_top = LinearGradient(gradient: Gradient(colors: [Color(hex:0xFFFFFF, alpha: 1), Color(hex:0xFFFFFF, alpha: 0)]), startPoint: .top, endPoint: .bottom)
    static let g_color_bg_gradient_white_bottom = LinearGradient(gradient: Gradient(colors: [Color(hex:0xFFFFFF, alpha: 0), Color(hex:0xFFFFFF, alpha: 1)]), startPoint: .top, endPoint: .bottom)
    
    //    分割线色
    static let g_color_line = Color(hex: 0x7E868E, alpha: 0.16)
    
    //    主题色
    static let g_color_theme = Color(hex: 0x1774FF, alpha: 1)
    static let g_color_theme_dark = Color(hex: 0x1765DA, alpha: 1)
    static let g_color_theme_grey = Color(hex: 0x1774FF, alpha: 0.48)
    static let g_color_theme_light = Color(hex: 0x1774FF, alpha: 0.12)
    
    //    信息色
    static let g_color_msg_green = Color(hex: 0x00B042, alpha: 1)
    static let g_color_msg_orange = Color(hex: 0xFF9200, alpha: 1)
    static let g_color_msg_red = Color(hex: 0xFF5634, alpha: 1)
    static let g_color_msg_red_dark = Color(hex: 0xD33F0E, alpha: 1)
    static let g_color_msg_red_light = Color(hex: 0xFF5634, alpha: 0.48)
    
    //    拓展色
    static let g_color_extended_yellow = Color(hex: 0xF4C800, alpha: 1)
    static let g_color_extended_purple = Color(hex: 0xB963D3, alpha: 1)
    static let g_color_extended_water = Color(hex: 0x5AC8FA, alpha: 1)
    static let g_color_extended_pink = Color(hex: 0xEC4589, alpha: 1)
    static let g_color_extended_olive = Color(hex: 0x6F9200, alpha: 1)
    static let g_color_extended_lightgrey = Color(hex: 0xD7D7D7, alpha: 1)
    
    //    阴影
    static let g_color_shadow = Color(hex: 0x000000, alpha: 1)
    //    遮罩
    static let g_color_bg_mask = Color(hex: 0x000000,alpha: 0.4)
    //    弹窗
    static let g_color_bg_toast = Color(hex: 0x000000,alpha: 0.6)
 
}
enum ColorEnum {
    //    文字颜色
    case g_color_font_primary
    case g_color_font_secondary
    case g_color_font_description
    case g_color_font_disabled
    case g_color_font_fadeout
    case g_color_font_white
    //    背景色
    case g_color_bg_grey
    case g_color_bg_white
    case g_color_bg_dark
    case g_color_bg_transparent
    case g_color_bg_gradient_white_top
    case g_color_bg_gradient_white_bottom
    //    分割线色
    case g_color_line
    //    主题色
    case g_color_theme
    case g_color_theme_dark
    case g_color_theme_grey
    case g_color_theme_light
    //    信息色
    case g_color_msg_green
    case g_color_msg_orange
    case g_color_msg_red
    case g_color_msg_red_dark
    case g_color_msg_red_light
    //    拓展色
    case g_color_extended_yellow
    case g_color_extended_purple
    case g_color_extended_water
    case g_color_extended_pink
    case g_color_extended_olive
    case g_color_extended_lightgrey
    //    阴影
    case g_color_shadow
    //    遮罩
    case g_color_bg_mask
    //    弹窗
    case g_color_bg_toast
}
func CustomColor(param : ColorEnum) -> Color{
        switch param{
        case .g_color_font_primary:
            return Color(hex: 0x171A1D, alpha: 1)
        case .g_color_font_secondary:
            return Color(hex: 0x171A1D, alpha: 0.6)
        case .g_color_font_description:
            return Color(hex: 0x171A1D, alpha: 0.4)
        case .g_color_font_disabled:
            return Color(hex: 0x171A1D, alpha: 0.24)
        case .g_color_font_fadeout:
            return Color(hex: 0xFFFFFF, alpha: 0.4)
        case .g_color_font_white:
            return Color(hex: 0xFFFFFF, alpha: 1)
        case .g_color_bg_grey:
            return Color(hex: 0xF2F2F6, alpha: 1)
        case .g_color_bg_white:
            return Color(hex: 0xFFFFFF, alpha: 1)
        case .g_color_bg_dark:
            return Color(hex: 0x171A1D, alpha: 0.24)
        case .g_color_bg_transparent:
            return Color(hex: 0xFFFFFF, alpha: 0)
        case .g_color_bg_gradient_white_top:
            return Color(LinearGradient(gradient: Gradient(colors: [Color(hex:0xFFFFFF, alpha: 1), Color(hex:0xFFFFFF, alpha: 0)]), startPoint: .top, endPoint: .bottom) as! CGColor)
        case .g_color_bg_gradient_white_bottom:
            return Color(LinearGradient(gradient: Gradient(colors: [Color(hex:0xFFFFFF, alpha: 0), Color(hex:0xFFFFFF, alpha: 1)]), startPoint: .top, endPoint: .bottom) as! CGColor)
        case .g_color_line:
            return Color(hex: 0x7E868E, alpha: 0.16)
        case .g_color_theme:
            return Color(hex: 0x1774FF, alpha: 1)
        case .g_color_theme_dark:
            return Color(hex: 0x1765DA, alpha: 1)
        case .g_color_theme_grey:
            return Color(hex: 0x1774FF, alpha: 0.48)
        case .g_color_theme_light:
            return Color(hex: 0x1774FF, alpha: 0.12)
        case .g_color_msg_green:
            return Color(hex: 0x00B042, alpha: 1)
        case .g_color_msg_orange:
            return Color(hex: 0xFF9200, alpha: 1)
        case .g_color_msg_red:
            return Color(hex: 0xFF5634, alpha: 1)
        case .g_color_msg_red_dark:
            return Color(hex: 0xD33F0E, alpha: 1)
        case .g_color_msg_red_light:
            return Color(hex: 0xFF5634, alpha: 0.48)
        case .g_color_extended_yellow:
            return Color(hex: 0xF4C800, alpha: 1)
        case .g_color_extended_purple:
            return Color(hex: 0xB963D3, alpha: 1)
        case .g_color_extended_water:
            return Color(hex: 0x5AC8FA, alpha: 1)
        case .g_color_extended_pink:
            return Color(hex: 0xEC4589, alpha: 1)
        case .g_color_extended_olive:
            return Color(hex: 0x6F9200, alpha: 1)
        case .g_color_extended_lightgrey:
            return Color(hex: 0xD7D7D7, alpha: 1)
        case .g_color_shadow:
            return Color(hex: 0x000000, alpha: 1)
        case .g_color_bg_mask:
            return Color(hex: 0x000000,alpha: 0.4)
        case .g_color_bg_toast:
            return Color(hex: 0x000000,alpha: 0.6)
    }
}
